package cn.hchaojie.web;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class DemoResponse extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse response) throws ServletException, IOException {
		// 把字符串转成字节的时候，使用什么编码（默认使用的是iso-8859-1）
		// response.setCharacterEncoding("uft-8");
		response.setContentType("text/html;charset=utf-8");
		// response.setHeader("Content-Type", "text/html;charset=utf-8");
		response.setHeader("token", "123abc8dd");

		// 往浏览器输出内容
		PrintWriter writer = response.getWriter();
		
		writer.write("<html>");
		writer.write("<body>");
		writer.write("<h3>中</h3>");
		writer.write("</body>");
		writer.write("</html>");
		
		
		// iso-8859-1 
		// 
	}
}
